<?php

/**
 * WeEngine Api System
 *
 * (c) We7Team 2019 <https://www.w7.cc>
 *
 * This is not a free software
 * Using it under the license terms
 * visited https://www.w7.cc for more details
 */

namespace W7\Sdk\VSCode\Tests;

use W7\Sdk\VSCode\Traits\StorageTrait;

/**
 * fs rename
 */
class TestDirectoryRename extends TestCase {
	use StorageTrait;

	/**
	 * @var string
	 */
	private $route = '';
	/**
	 * @var string
	 */
	private $dirFrom = 'from';
	/**
	 * @var string
	 */
	private $dirFromRename = 'from1';

	protected function setUp(): void {
		parent::setUp(); // TODO: Change the autogenerated stub
		$this->route = route('vs.code.rename');
	}

	/**
	 * test rename directory
	 */
	public function testDirectoryRename() {
		$this->storageDeleteDir($this->dirFrom);
		$this->storageDeleteDir($this->dirFromRename);

		$this->storageMakeDir($this->dirFrom);
		$this->assertTrue($this->storageIsExists($this->dirFrom));

		$this->putJson($this->route, ['uri' => $this->dirFrom, 'newuri' => $this->dirFromRename])->assertOk();
		$this->assertTrue($this->storageIsExists($this->dirFromRename));
	}
}
